OpenGL

Eric Wilhelm on 2008-10-18T21:48:42

Working on VectorSection again, I thought I would take another look at the Wx::GLCanvas and doing a little something with polygons.

From the Wx::GLCanvas demo:

sub cube { my( @v ) = ( [ 1, 1, 1 ], [ -1, 1, 1 ], [ -1, -1, 1 ], [ 1, -1, 1 ], [ 1, 1, -1 ], [ -1, 1, -1 ], [ -1, -1, -1 ], [ 1, -1, -1 ] ); my( @c ) = ( [ 1, 1, 0 ], [ 1, 0, 1 ], [ 0, 1, 1 ], [ 1, 1, 1 ], [ 0, 0, 1 ], [ 0, 1, 0 ], [ 1, 0, 1 ], [ 1, 1, 0 ] ); my( @s ) = ( [ 0, 1, 2, 3 ], [ 4, 5, 6, 7 ], [ 0, 1, 5, 4 ], [ 2, 3, 7, 6 ], [ 1, 2, 6, 5 ], [ 0, 3, 7, 4 ] );

for my $i ( 0 .. 5 ) { my $s = $s[$i]; glBegin(GL_QUADS); foreach my $j ( @$s ) { glColor3f( @{$c[$j]} ); glVertex3f( @{$v[$j]} ); } glEnd(); } }


I sense an abstraction layer in my future, but undoubtedly it is going to be at the other end of some very sloggy slogging.